﻿using System;
using MaLu.Data;
using System.Web.UI;

namespace MaLu.Common
{
    public class VisitePage1 : Page
    {
        private IDbProvider provider = null;
        protected IDbProvider Provider
        {
            get
            {
                if (provider == null)
                {
                    provider = ProviderManager.Factory.CreateDbProvider();
                    provider.Open();

                }
                return provider;
            }

        }
        public int Year
        {
            get
            {
                int _year = 0;
                int.TryParse(Request["year"] ?? "0", out _year);
                if (_year == 0)
                    _year = DateTime.Today.Year;
                return _year;
            }

        }
        public int Month
        {
            get
            {
                int _month = 0;
                int.TryParse(Request["month"] ?? "0", out _month);
                DateTime dt = DateTime.Now;

                if (DateTime.TryParse("2011-" + _month + "-1 0:0:0", out dt))
                {
                    return dt.Month;
                }
                else
                    return 0;
            }

        }
        public Guid VisiteID
        {

            get
            {
                Guid gd = Guid.NewGuid();
                try
                {

                    gd = new Guid(Request["VisiteID"]);
                }

                catch
                { }

                return gd;
            }

        }

        public Guid ItemID
        {
            get
            {
                Guid gd = Guid.Empty;
                try
                {
                    gd = new Guid(Request["ItemID"]);
                }

                catch
                { }
                return gd;
            }
        }
    }
}